using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class tankstart : MonoBehaviour
{
    public GameObject player;
    public GameObject[] playerPos;
    public bool Startwo = false;
    public static tankstart tankstart_Instance;
    // Start is called before the first frame update

    void Awake()
    {
        tankstart_Instance = this;
    }
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        Cursor.visible = false;
        Vector3 pos1 = playerPos[0].transform.position;
        Vector3 pos2 = playerPos[1].transform.position;
        Vector3 pos3 = playerPos[2].transform.position;
        if (Input.GetKeyDown(KeyCode.DownArrow)||Input.GetKeyDown(KeyCode.S)) 
        {
            if (player!=null&&playerPos.Length>=3) 
            {
                
                player.transform.position = player.transform.position == pos1 ? pos2 : pos3;
            }
        }
        if (Input.GetKeyDown(KeyCode.UpArrow)||Input.GetKeyDown(KeyCode.W))
        {
            if (player != null && playerPos.Length >= 3)
            {

                player.transform.position = player.transform.position == pos3 ? pos2 : pos1;
            }
        }

        if ((Input.GetKeyDown(KeyCode.Return)||Input.GetKeyDown(KeyCode.KeypadEnter))&& player.transform.position == pos1) 
        {
            
           
            SceneManager.LoadScene("BattleCity1");
        }

        if ((Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && player.transform.position == pos2)
        {
            Startwo = true;
            SceneManager.LoadScene("BattleCity2");
        }

        if ((Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && player.transform.position == pos3)
        {
            
            SceneManager.LoadScene("RankingList");
        }
    }
}
